# A tibble: 16,327 × 12
Rank Name date Platform Year Genre Publisher NA_Sales EU_Sales
<dbl> <chr> <date> <chr> <dbl> <chr> <chr> <dbl> <dbl>
1 1 Wii Sports 2006-11-19 Wii 2006 Spor… Nintendo 41.5 29.0
2 2 Super Mari… 1985-09-13 NES 1985 Plat… Nintendo 29.1 3.58
3 3 Mario Kart… 2008-04-10 Wii 2008 Raci… Nintendo 15.8 12.9
4 4 Wii Sports… 2009-01-01 Wii 2009 Spor… Nintendo 15.8 11.0
5 5 Pokemon Re… 1996-01-01 GB 1996 Role… Nintendo 11.3 8.89
6 6 Tetris 1989-11-01 GB 1989 Puzz… Nintendo 23.2 2.26
7 7 New Super … 2006-05-15 DS 2006 Plat… Nintendo 11.4 9.23
8 8 Wii Play 2006-01-01 Wii 2006 Misc Nintendo 14.0 9.2
9 9 New Super … 2009-11-12 Wii 2009 Plat… Nintendo 14.6 7.06
10 10 Duck Hunt 1984-01-01 NES 1984 Shoo… Nintendo 26.9 0.63
# ℹ 16,317 more rows
# ℹ 3 more variables: JP_Sales <dbl>, Other_Sales <dbl>, Global_Sales <dbl>
=======================================================================
# A tibble: 16,327 × 12
Rank Name date Platform Year Genre Publisher NA_Sales EU_Sales
<dbl> <chr> <date> <chr> <dbl> <chr> <chr> <dbl> <dbl>
1 1 Wii Sports 2006-11-19 Wii 2006 Spor… Nintendo 41.5 29.0
2 2 Super Mari… 1985-09-13 NES 1985 Plat… Nintendo 29.1 3.58
3 3 Mario Kart… 2008-04-10 Wii 2008 Raci… Nintendo 15.8 12.9
4 4 Wii Sports… 2009-01-01 Wii 2009 Spor… Nintendo 15.8 11.0
5 5 Pokemon Re… 1996-01-01 GB 1996 Role… Nintendo 11.3 8.89
6 6 Tetris 1989-11-01 GB 1989 Puzz… Nintendo 23.2 2.26
7 7 New Super … 2006-05-15 DS 2006 Plat… Nintendo 11.4 9.23
8 8 Wii Play 2006-01-01 Wii 2006 Misc Nintendo 14.0 9.2
9 9 New Super … 2009-11-12 Wii 2009 Plat… Nintendo 14.6 7.06
10 10 Duck Hunt 1984-01-01 NES 1984 Shoo… Nintendo 26.9 0.63
# ℹ 16,317 more rows
# ℹ 3 more variables: JP_Sales <dbl>, Other_Sales <dbl>, Global_Sales <dbl>
=======================================================================
# A tibble: 16,327 × 12
Rank Name date Platform Year Genre Publisher NA_Sales EU_Sales
<dbl> <chr> <date> <chr> <dbl> <chr> <chr> <dbl> <dbl>
1 1 Wii Sports 2006-11-19 Wii 2006 Spor… Nintendo 41.5 29.0
2 2 Super Mari… 1985-09-13 NES 1985 Plat… Nintendo 29.1 3.58
3 3 Mario Kart… 2008-04-10 Wii 2008 Raci… Nintendo 15.8 12.9
4 4 Wii Sports… 2009-01-01 Wii 2009 Spor… Nintendo 15.8 11.0
5 5 Pokemon Re… 1996-01-01 GB 1996 Role… Nintendo 11.3 8.89
6 6 Tetris 1989-11-01 GB 1989 Puzz… Nintendo 23.2 2.26
7 7 New Super … 2006-05-15 DS 2006 Plat… Nintendo 11.4 9.23
8 8 Wii Play 2006-01-01 Wii 2006 Misc Nintendo 14.0 9.2
9 9 New Super … 2009-11-12 Wii 2009 Plat… Nintendo 14.6 7.06
10 10 Duck Hunt 1984-01-01 NES 1984 Shoo… Nintendo 26.9 0.63
# ℹ 16,317 more rows
# ℹ 3 more variables: JP_Sales <dbl>, Other_Sales <dbl>, Global_Sales <dbl>
---
title: "Video Games - Flex"
output:
flexdashboard::flex_dashboard:
orientation: columns
vertical_layout: fill
source_code: embed
social: menu
logo: VG1.jpg
---
```{r setup, include=FALSE}
library(flexdashboard)
library(tidyverse)
#install.packages("plotly")
library(plotly)
library(knitr)
library(DT)
library(flexdashboard)
library(tidyverse)
library(knitr)
df <- read_csv('vgsales2.csv')
df$Year <- as.numeric(df$Year)
df$date <- as.Date(df$date)
head(df)
# Create a ggplot object
df1 = df %>%
ggplot()+
geom_point(aes(x=NA_Sales, y=EU_Sales))+labs(title="Sales by North America and Europe", caption="For males, there are more stays over 500 days for people under 40 years old. But there are no major differences between genders")
df1
df2 = df %>%
filter(Platform=='PS4'|Platform=='XOne') %>%
ggplot()+
geom_point(aes(x=NA_Sales, y=EU_Sales))+facet_wrap(~Platform)+labs(title="Sales by PS4 and Xbox One", caption="There are more North American sales than European in general")
df2
```
{.sidebar}
=======================================================================
Sales by Location
=======================================================================
Column {data-width=500, .tabset}
-----------------------------------------------------------------------
### Dataset Preview
```{r}
df
```
### Dataset Search
```{r}
datatable(df, options = list(
pageLength = 25
))
```
Column {data-width=500}
-----------------------------------------------------------------------
### Graph 1
```{r}
df$Year <- as.numeric(df$Year)
hist(df$Year)
```
### Graph 2
```{r}
ggplotly(df1)
```
=======================================================================
Sales by Platform
=======================================================================
Column {data-width=500, .tabset}
-----------------------------------------------------------------------
### Dataset Preview
```{r}
df
```
### Dataset Search
```{r}
datatable(df, options = list(
pageLength = 25
))
```
Column {data-width=500}
-----------------------------------------------------------------------
### Graph 1
```{r}
df %>%
filter(Platform=='Wii'|Platform=='PS4'|Platform=='X360') %>%
ggplot()+
geom_bar(mapping=aes(x=Year, fill=Platform),
position = 'dodge')+labs(title="Console Sales by Year", caption="Wii and Xbox 360 sales go down as PS4 sales go up")
```
### Graph 2
```{r}
df %>%
filter(Year=='2015') %>%
group_by(Platform) %>%
summarise(avgsales=mean(Global_Sales, na.rm=TRUE)) %>%
ggplot()+
geom_col(mapping=aes(x=Platform, y=avgsales))+labs(title="Average Sales by Platform",caption="PS4 has the highest average sales out of any console")
```
=======================================================================
Sales by Publisher
=======================================================================
Column {data-width=500, .tabset}
-----------------------------------------------------------------------
### Dataset Preview
```{r}
df
```
### Dataset Search
```{r}
datatable(df, options = list(
pageLength = 25
))
```
Column {data-width=500}
-----------------------------------------------------------------------
### Graph 1
```{r}
df %>%
filter(Platform=="PS4"|Platform=="PS3"|Platform=="PS2") %>%
ggplot()+
geom_bar(mapping=aes(x=Year, fill=Platform))+labs(title="Count Playstation Console Sales by Year", caption="PS3 overtakes PS2 around 2009 and PS4 overtakes PS3 around 2015")
```
### Graph 2
```{r}
df %>%
filter(Publisher=="Electronic Arts"|Publisher=="Activision") %>%
ggplot()+
geom_bar(mapping=aes(x=Platform, fill=Publisher), position = 'fill')+labs(title="Percentage of platforms with games published by EA or Activision", caption="Overall EA is a much more popular publisher than Activision for platforms")
```